{include file="Index/header" /}
<div class="formbody">
<div class="formtitle"><span>管理员列表</span></div>
	<div id="usual1" class="usual">
		<div id="tab2" class="tabson">
			<form action="{:url('Manage/adminList')}" method="post">
				<ul class="seachform">
					<li><label>管理员名</label>
						<input name="adminName" type="text" class="scinput" value="{$adminName}"/>&nbsp;&nbsp; 
					</li>
					<li><label>&nbsp;</label>
						<input name="query" type="submit" class="scbtn" value="查询" />
					</li>
				</ul>
			</form>
			<div id="ajax_dom">
				<table class="tablelist" >
					<thead>
						<tr>
							<th>编号</th> 
							<th>管理员账号</th>
							<th>真实姓名</th>
							<th>用户组</th>
							<th>用户状态</th>
							<th>手机号</th>
							<th>添加时间</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody id="tab_body">
					{if $adminArr}
						{volist name="adminArr" id="v" key="k"}
							<tr id="tr_{$v.id}">
								<td>{$v.id}</td>
								<td>{$v.username}</td>
								<td>{$v.truename}</td>
								<td>{$group_arr[$v[group_id]]}</td>
								<td id="act_{$v.id}">
									{if $v[status]== '1'}
										<span style="color:green;" class="status">激活</span>
									{else /}
										<span style="color:red;" class="status">冻结</span>
									{/if}
								</td>
								<td>{$v.mobile}</td>
								<td>{:date("Y-m-d",$v[on_time])}</td>
								<td>	
									<a href="{:url('Manage/adminAdd', array('admin_id'=>$v[id]))}" class="tablelink">编辑</a>
									<a href="javascript:void(0);" class="tablelink" onclick="del({$v.id});">删除</a>
									{if $v[status]== '1'}
										<span id="set_status_{$v.id}"><a href="javascript:void(0);" class="tablelink" onclick="is_act({$v.id},2);">冻结</a></span>
									{else /}
										<span id="set_status_{$v.id}"><a href="javascript:void(0);" class="tablelink" onclick="is_act({$v.id},1);">激活</a></span>
									{/if}
									<a href="javascript:void(0);" data="{:url('System/userRepwd', array('id'=>$v[id]))}" class="tablelink" onclick="userRepass(this);">修改密码</a>
								</td>
							</tr>
						{/volist}
					{else /}
						<tr>
							<td colspan="8" style="text-align:center;">没有符合当前查找条件的值！</td>
						</tr>
					
					{/if}
					</tbody>
				</table>
				<div class="page">
					{$pages}
				</div>
			</div>
		</div>
	</div>
</div>


<script>
//修改密码
function userRepass(obj){

	 art.dialog.open($(obj).attr("data"),{title:'重置密码',height:'120px',close:function (){
		 if(art.dialog.data('op')=='ok'){  
	 		
			 art.dialog.tips('修改密码成功'); 
		 }
		
	 }});
	
	
}


//激活或冻结
	function is_act(admin_id,status){
		$.post("{:url('Manage/setstatus')}",{
			'admin_id':admin_id,
			'status':status
		},function(json){
			if(json.data=="1"){
				$("#act_"+admin_id).html('<span style="color:green;" class="status">激活</span>');
				$("#set_status_"+admin_id).html('<a href="javascript:void(0);" class="tablelink" class="set_status" onclick="is_act('+admin_id+',2);">冻结</a>');
			}else{
				$("#act_"+admin_id).html('<span style="color:red;" class="status">冻结</span>');
				$("#set_status_"+admin_id).html('<a href="javascript:void(0);" class="tablelink" class="set_status" onclick="is_act('+admin_id+',1);">激活</a>');
			}
		},'json');
	}

/* 删除用户信息 */
	function del(obj_id){
		$.post("{:url('Manage/delete')}",{
			'admin_id':obj_id
		},function (json){
			if(json.status == "1"){
				$("#tr_"+obj_id).remove();
			}else{
				alert("删除失败");
			}
		},'json');
	}
 


</script>


{include file="Index/footer" /}
